﻿----------------------------------------------------------------------------------------------------
--
--  © 2012 Stanislav S. Yarmonov.
--
--  TODO:LICENSE
--     
----------------------------------------------------------------------------------------------------
IF OBJECT_ID(N'[_DB].[Function_Drop]', N'P') IS NOT NULL
	DROP PROCEDURE [_DB].[Function_Drop]
GO

----------------------------------------------------------------------------------------------------
--
--  User-defined function dropping routine.
--
--  INPUT
--		@@Name
--		Name of the user-defined function to be dropped.
--
----------------------------------------------------------------------------------------------------
CREATE PROCEDURE [_DB].[Function_Drop]
	@@Name [sysname]
AS
SET NOCOUNT ON

IF [_DB].[Function_Exists](@@Name) = 1
BEGIN
	DECLARE @SQL [nvarchar](max) SELECT @SQL =
		N'DROP FUNCTION ' + @@Name

	EXECUTE(@SQL)
END

RETURN 0
GO
